# -*- coding:utf-8 -*-

from .celery_common_cfg import *

import glob

# 从 services/asyntask 下面导入 包含task的模块 到配置项 CELERY_IMPORTS 中
dirFiles = glob.glob("services/asyntask/*")
dirFiles2 = glob.glob("services/asyntask/paper/*")
targetModules = []

# print '\nCELERY_IMPORTS are:'
for targetdir in [dirFiles, dirFiles2]:
    for one in targetdir:
        if '__' in one:
            continue
        if not one.endswith('.py'):
            continue

        newone = one.replace('/', '.').replace('\\', '.').replace('.py', '')
        # print '  ' + newone
        targetModules.append(newone)


CELERY_IMPORTS = tuple(targetModules)  # ('celerytasks.idle_tasks',)

# Disabling rate limits altogether is recommended if you don’t have any tasks using them.
# This is because the rate limit subsystem introduces quite a lot of complexity.
CELERY_DISABLE_RATE_LIMITS = True
